<?php
/**
 *
 * 问答提交
 *
 * @version        2013年1月16日Z Yeshili
 * @author         叶世立 QQ：371773984
 */
require_once(dirname(__FILE__)."/../include/common.inc.php");
if(!isset($action))
{
    $action = '';
}
if($action=='send')
{
    //检查验证码
    if(preg_match("/3/",$safe_gdopen)){
        $validate = isset($validate) ? strtolower(trim($validate)) : '';
        $svali = GetCkVdValue();
        if(strtolower($validate)!=$svali || $svali=='')
        {
            ResetVdValue();
            ShowMsg('验证码错误！', '-1');
			$validate="";
            exit();
        }
        
    }

    //保存评论内容
    if($comtype == 'comments')
    {
		$row=$dsql->GetOne("SELECT id FROM `#@__archives` order by id desc");
		$aid=$row['id']+1;
        $title =$title;
		$typeid = $typeid;
		$content = $content;
		$source = $source;
		$shijian = mktime();
		$ip = GetIP();
		$prweb=$_SERVER[HTTP_REFERER];
        if($content!='')
        {
		   //主表
           $inquery = "INSERT INTO `#@__archives`(`id`,`typeid`,`sortrank`,`ismake`,`channel`,`arcrank`, `title`,`writer`,`source`,`pubdate`,`SendDate`,`mid`,`dutyadmin`) VALUES ('$aid','$typeid','$shijian','0','2','-1','$title','未知','$source', '$shijian','$shijian','1','1'); ";
           $dsql->ExecuteNoneQuery($inquery);
		   //附加表
		   $inquerys = "INSERT INTO `#@__addonarticleask`(`aid`,`typeid`,`body`,`userip`) VALUES ('$aid','$typeid','$content','$ip'); ";
		   $dsql->ExecuteNoneQuery($inquerys);
		   //统计表
		   $inqueryss = "INSERT INTO `#@__arctiny`(`id`,`typeid`,`arcrank`,`channel`,`SendDate`,`sortrank`,`mid`) VALUES ('$aid','$typeid','-1','2','$shijian','$shijian','4'); ";
		   $dsql->ExecuteNoneQuery($inqueryss);
        }
		ShowMsg('你的留言提交成功,请等待老师回答，谢谢！',$prweb);
    }
}